<?php

class m120529_132251_qa_init extends EDbMigration {

	public function safeUp() {
		$columns = array(
			'id'=>'pk',
			'title'=>'varchar(255) not null',
			'value'=>'text not null',
			'preserved'=>'boolean default 0',
			'viewCount'=>'integer default 0',
			'createdAt'=>'datetime',
			'updatedAt'=>'datetime',
			'createdBy'=>'integer',
			'updatedBy'=>'integer',
		);
		$this->createTable('questions', $columns);

		$columns = array(
			'id'=>'pk',
			'questionId'=>'integer not null',
			'value'=>'text not null',
			'createdAt'=>'datetime',
			'updatedAt'=>'datetime',
			'createdBy'=>'integer',
			'updatedBy'=>'integer',
		);
		$this->createTable('answers', $columns);
	}

	public function safeDown() {
		$this->dropTable('answers');
		$this->dropTable('questions');
	}

}